import java.util.ArrayList;
import java.util.Arrays;
import java.util.HashMap;
import java.util.Set;

public class Demo5 {
    public static void main(String[] args) {
        String str = "abcdghijkabc";
        byte[] bytes = str.getBytes();
        System.out.println(Arrays.toString(bytes));
        ArrayList<Integer> list = new ArrayList<>();
        int temp = 0;
        int count = 0;
        HashMap<Integer, Integer> map = new HashMap<>();
        for (int i = 1; i < str.length(); i += 1) {
            temp = bytes[i] - bytes[i - 1];
            if (temp == 1) {
                count += 1;
            } else if (temp != 1) {
                if (count >= 2) {
                    map.put(i - count - 1, count + 1);
                }
                count = 0;
            }
            if (i == str.length() - 1) {
                if (count >= 2) {
                    map.put(i - count, count + 1);
                }
            }
            list.add(temp);
        }
        System.out.println(list);
        System.out.println(map);
        ArrayList<String> result = new ArrayList<>();
        Set<Integer> integers = map.keySet();
        for (Integer integer : integers) {
            java.lang.String s = new String(bytes, integer, map.get(integer));
            result.add(s);
        }
        System.out.println(result);
    }
}
